<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Cache-Control" content="no-cache" />
		<meta http-equiv="Expires" content="0" />
		<meta http-equiv="X-UA-Compatible" content="E=edge;chrome=1" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<title>注册</title>
		<link rel="stylesheet" type="text/css" href="<%=path%>/static/css/reset.css">
	    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/weui.min.css">
	    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/index.css">
	    <script type="text/javascript" src="<%=path%>/static/js/jquery-3.2.1.min.js"></script>
        <script type="text/javascript" src="<%=path%>/static/js/weui.min.js"></script>
        <script type="text/javascript" src="<%=path%>/static/js/index.js"></script>
        <script type="text/javascript" src="<%=path%>/static/layer/layer.js"></script>
        <script type="text/javascript" src="<%=path%>/static/js/setBtnColor.js"></script>
    </head>
   <body>
    <div class="registered">
        <div class="header">
            <div><!-- <div class="back"></div> --></div>
            <div>密码登录</div>
            <div><div class="re"><%-- <a href="<%=path%>/member/add.html">注册</a> --%></div></div>
        </div>
        <div class="main">
            <div class="banner-wrap login-banner">
                <img src="<%=path%>/static/img/member/logo.png" alt="logo">
            </div>
            <div class="registered-form">
                <form >
                    <ul class="registered-form-wrap">
                        <li class="li-border">
                            <label><div class="phone-icon left icon"></div><input pl="请输入手机" class="left content user-number"></label>
                        </li>
                        <li class="three-line">
                            <label><div class="sms-icon left icon"></div><input pl="请输入密码" class="left content user-pass"></label>
                            <div class="right verification-code right-code"></div>
                        </li>
                    </ul>
                </form>
            </div>
             <li class="error">
                 <div class="error-content"></div>
             </li>
            <div class="login-btn h-btn"><a>登录</a></div>
            <div class="login-text"><a class="right" href="<%=path %>/login/smsLogin.html">短信登录</a><!-- <a class="right">忘记密码？</a> --></div>
        </div>
    </div>
</body>
<script type="text/javascript">
function loginForm() {
    var pattern = /^1[34578]\d{9}$/;
    if($(".user-number").val() == "请输入手机" || $(".user-number").val() == "") {
        $(".error-content").text("*请输入手机 ");
        return false;
    }
    if($(".user-pass").val() == "请输入密码" || $(".user-pass").val() == "") {
        $(".error-content").text("* 请输入密码");
        return false;
    }
    if(!pattern.test($(".user-number").val())){
    	$(".error-content").text("* 手机号错误");
        return false;
    }
    return true;
}

var flag= true;
var path="<%=path%>"
$(".login-btn").on("touchstart",function() {
	if(loginForm()){
		if(flag){
			$.ajax({
				url:path+"/login/login.html",
	             data:{
	                 phone:$(".user-number").val(),
	                 password:$(".user-pass").val()
	              },
	             type : "POST",
	             datatype : "json",
	             async: false,
	             success : function(datas) {
	            	 flag=true;
	            	 var json = eval("("+datas+")");
	            	 if(json.code==200){
	            		 window.location='<%=path %>/member/memberCenter.html'; 
	            	 }else{
	            		 layer.msg(json.msg);
	            	 }
	             }
			});
		}
	}	
})
</script>
</html>
